#include "types.h"
#include "core.h"
#include <iostream>

using namespace std;

Object*
testFunction (List* args)
{
  cout << "Inside a test function, oh my!\n";
  return args;
}

int
main ()
{
  cout << "~~~ REDLisp Test 2 ~~~\n";
  cout << "\n*** INDENT TEST ***\n";
  indent (">");
  cout << indent () << "indent level 1\n";
  cout << indent () << "indent level 2\n";
  cout << indent () << "indent level 3\n";
  cout << indent () << "indent level 4\n";
  indent ("....");
  cout << indent () << "indent level 1\n";
  cout << indent () << "indent level 2\n";
  init_utility ();
  cout << "\n*** PAIR TEST 1 ***\n";
  List* pair = createPair (new Symbol ("string"), new String ("Hello World"));
  cout << "createPair (\"string\", \"Hello World\"): "
       << pair->toString () << "\n";
  List* pair2 = createPair (new Symbol ("string2"), new String ("Stop"));
  cout << "createPair (\"string2\", \"Stop\"): "
       << pair->toString () << "\n";
  cout << "\n*** PAIR TEST 2 ***\n";
  List* env = new List ();
  add (pair, env);
  cout << "add (pair, env): " << env->toString () << "\n";
  add (pair2, env);
  cout << "add (pair2, env): " << env->toString () << "\n";
  cout << "\n*** PAIR TEST 3 ***\n";
  Object* result = get (new String ("string"), env);
  cout << "get (\"string\", env): " << result->toString () << "\n";
  result = get (new String ("string1"), env);
  cout << "get (\"string1\", env): " << result->toString ()
       << "\n*** COMPILED FUNCTION TEST ***\n";
  CFunction* cfunc = new CFunction (testFunction);
  cout << "Created cfunc with testFunction\n"
       << "cfunc->call (env): " << cfunc->call (env)->toString ()
       << endl;
  return 0;
}
